from tkinter import *;

class App:
	#master就是rootWindow
	def __init__(self,master):
		frame=Frame(master);#frame 的父级是 master
		frame.pack();
		#button的父级是 frame
		self.button=Button(frame,text='点我退出',fg='red',command=frame.quit);
		self.button.pack();
		#再加一个按钮
		self.hiButton=Button(frame,text='Say Hi',command=self.say_hi);
		self.hiButton.pack();

	def say_hi(self):
		print ("Hi JiangJun ...");	

root=Tk();
app=App(root);
root.mainloop();		